<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="UTF-8">
  <title>Service test</title>
  <link rel="stylesheet" href="../../../lib/bootstrap/3.3.5/css/bootstrap.min.css"/>
</head>
<body>

<div id="res" class="container-fluid">

  <div class="row-fluid">
    <div class="col-sm-12">
      <h3 class="page-header text-center">
        文件管理
      </h3>
    </div>
  </div>

  <div class="row" >
    <div class="col-sm-12">
      <div class="col-sm-3">
        <button class="btn btn-default" v-on:click:="onRemoveSelected($event)">删除选中记录</button>
        <a href="#add" v-on:click="setMode('modeAddNew')">新增</a>
      </div>
      <!-- <form id="search"> -->
      <div class="col-sm-offset-3 col-sm-3">
        <input id="searchQuery" name="query" type="text" style="float:right" v-model="searchQuery" class="form-control" required />
      </div>
      <div class="col-sm-2">
        <button id='search' class="btn btn-outline btn-block btn-success save" v-on="click:basicsearch($event)"><strong>搜索</strong></button>
      </div>
      <div class="col-sm-1 text-left vertical-middle-sm">
        <h5><strong>
          <a role="button" class="control-label" data-toggle="collapse" href="#advancedsearch" aria-expanded="false" aria-controls="advancedsearch">高级...</a>
        </strong></h5>
      </div>
      <!-- </form> -->
    </div>
  </div>

  <div class="row">
    <div class="col-sm-12">
      <br/>
    </div>
  </div>

  <div class="row">
    <div class="collapse col-sm-12" id="advancedsearch">
      <div class="well">
        <div class="row">
          <!-- <form class="form-horizontal contract-form"> -->
          <div class="form-group">
            <label class="col-sm-1 control-label">Begin Time</label>
            <div class="col-sm-5">
              <input id="begintime" name="begintime" type="text" v-model="begintime" value="2015-01-01" class="form-control" required />
            </div>
            <label class="col-sm-1 control-label">End Time</label>
            <div class="col-sm-5">
              <input id="endtime" name="endtime" type="text" v-model="endtime" value="2015-02-01"
                     class="form-control" required />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-1 control-label">Logger Id</label>
            <div class="col-sm-5">
              <input id="deviceid" name="deviceid" type="text" v-model="remotedevice" value="" class="form-control" required />
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-offset-9 col-sm-1">
              <button class="btn btn-outline btn-block btn-warning">清除</button>
            </div>
            <div class="col-sm-2">
              <button id='submitbutton' class="btn btn-outline btn-block btn-success save" v-on="click:advancedsearch($event)">提交</button>
            </div>
          </div>
          <!-- </form> -->
        </div>
      </div>
    </div> <!-- advancedsearch -->
  </div>

  <div id="objectlist" v-show="mode=='modeList'">

    <div class="row">
      <div class="table-responsive col-sm-12">
        <table class="table table-bordered table-condensed table-striped">
          <thead>
          <tr>
            <th></th>
            <th>id</th>
            <th>state</th>
            <th>content</th>
            <th>oper</th>
          </tr>
          </thead>
          <tbody>
          <tr v-for="item in items">
            <td><input type="checkbox" v-model="item.selected"></td>
            <td><a href="#" v-on:click="onChange(item)">{{item.shortname}}</a>
              <ul class="media-list row contacts-container"></ul>
            </td>
            <td>{{item.content}}</td>
            <td>{{item.state}}</td>
            <td>
              <a href="#" v-on:click="onEdit(item,'modeEdit')">Edit</a>&nbsp;|
              <a href="#" v-on:click="onRemove(item)">remove</a>
            </td>
          </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
  <!--/modeList-->

  <div id="objectadd" v-show="mode=='modeAddNew'">
    <div class="row">
      <itemadd mode="{{mode}}" item="{{curitem}}" on-submit="{{onSave}}" on-cancel="{{onCancel}}"></itemadd>
    </div>
  </div>
    <!--/modeAddNew-->

  <div id="objecteditor" v-show="mode=='modeEdit'">
    <div class="row">
      <itemeditor mode="{{mode}}" item="{{curitem}}" on-submit="{{onSave}}" on-cancel="{{onCancel}}"></itemeditor>
    </div>
  </div>
    <!--/modeEdit-->

</div>
<!--/res-->

<template id="itemeditor-tpl">
  <div class="col-sm-12">
    <!--form begin-->
    <form method="post">
    <div class="form-horizontal">

      <div class="site-bgcolor">
        <hr/>

        <div class="form-group">
          <label for="id1" class="col-sm-2 control-label">Id</label>

          <div class="col-sm-4">
            <input class="form-control" id="id1" name="id" placeholder="文件路径\\文件名.后缀名" v-model="item.id">
          </div>
        </div>

        <div class="form-group">
          <label for="content1" class="col-sm-2 control-label" >Content</label>

          <div class="col-sm-4">
            <input class="form-control" id="content1" name="content" placeholder="content" v-model="item.content"/>
          </div>

        </div>

        <hr/>
      </div>

      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <button class="btn btn-default" v-on:click="onCancelClick($event)">取消</button>
          <button class="btn btn-default" v-on:click="onSubmitClick($event)">提交</button>
        </div>
      </div>

    </div>
    </form>
    <!-- </form> -->

        <pre>
            <div>{{ $items | json }}</div>
        </pre>

  </div>
</template>

<template id="itemadd-tpl">
 <div class="col-sm-12">
  <div class="form-horizontal">
    <div class="site-bgcolor">
      <hr/>
      hello world

      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <button class="btn btn-default" v-on:click="onCancelClick($event)">取消</button>
          <button class="btn btn-default" v-on:click="onSubmitClick($event)">提交</button>
        </div>
      </div>
      </div>
    </div>
   </div>
</template>


<script src="../../../lib/jquery/2.1.4/jquery-2.1.4.min.js"></script>
<script src="../../../lib/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="../../../node_modules/vue/dist/vue.js"></script>
<script src="../../../node_modules/vue-resource/dist/vue-resource.js"></script>

<script src="sedt-v2.js"></script>
</body>
</html>
